package com.rs.admin.common;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;

import java.util.List;

/**
 * @author: ygj
 * @description:
 **/
@Data
public class PrintResult<T> {
    //数据条数
    private Integer Retcode;
    //数据
    private List<T> data;

    public static PrintResult jsonToObject(String json, Class t) {
        PrintResult result = new PrintResult();
        JSONObject jsonObject = JSON.parseObject(json);
        result.setRetcode(jsonObject.getInteger("Retcode"));
        List objects = JSONObject.parseArray(jsonObject.getString("datas"), t);
        result.setData(objects);
        return result;
    }



}
